﻿@using OSBLE.Resources
@using OSBLE.Models.Assignments
@model DynamicDictionary
@{
    dynamic dataModel = Model;
    IAssignmentTeam currentTeam = dataModel.TeacherCritical.AssignmentTeam as IAssignmentTeam;
    AssignmentTeam at = currentTeam as AssignmentTeam;
    bool isPdfReviewAssignment = false;
    if(dataModel.TeacherCritical.IsPdfReviewAssignment != null)
    {
        isPdfReviewAssignment = dataModel.TeacherCritical.IsPdfReviewAssignment;
    }
    List<ReviewTeam> reviewTeams = dataModel.TeacherCritical.ReviewTeams;
    List<ReviewTeam> userReviews = reviewTeams.Where(rt => rt.ReviewTeamID == at.TeamID).ToList();
}
@if (dataModel.TeacherCritical.hasSubmission)
{
    string download = dataModel.TeacherCritical.fractionReviewed;
    <td>
        @(Html.ActionLink(
                        download,
                        "GetSubmissionZip",
                        "FileHandler",
                        new { area = "", assignmentID = currentTeam.Assignment.ID, teamId = currentTeam.Team.ID },
                        new
                        {
                            onclick = "create_and_open_downloading_submission_dialog()",
                            title = dataModel.TeacherCritical.altText
                        })
                        )
    </td>
}
else if (isPdfReviewAssignment)
{
    <td>
    <ul id="ReviewsItems">
    @foreach (ReviewTeam review in userReviews)
    {
        <li>
            @review.AuthorTeam.Name
        </li>
    }
    </ul>
    </td>
}
else
{
    <td title ="@dataModel.TeacherCritical.altText">
        None Submitted
    </td>
}
